/* find_all.c

   Example for octopus_usb_find_all()

   This program is distributed under the GPL, version 2
*/

#include <stdio.h>
#include <octopus.h>

int main(int argc, char **argv)
{
#if 0
    int ret, i;
    struct octopus_context octopusc;
    struct octopus_device_list *devlist, *curdev;
    char manufacturer[128], description[128];

    octopus_init(&octopusc);

    if((ret = octopus_usb_find_all(&octopusc, &devlist, 0x0403, 0x6001)) < 0) {
        fprintf(stderr, "octopus_usb_find_all failed: %d (%s)\n", ret, octopus_get_error_string(&octopusc));
        return EXIT_FAILURE;
    }

    printf("Number of FTDI devices found: %d\n", ret);

    i = 0;
    for (curdev = devlist; curdev != NULL; i++) {
        printf("Checking device: %d\n", i);
        if((ret = octopus_usb_get_strings(&octopusc, curdev->dev, &manufacturer, 128, description, 128, NULL, 0)) < 0) {
            fprintf(stderr, "octopus_usb_get_strings failed: %d (%s)\n", ret, octopus_get_error_string(&octopusc));
            return EXIT_FAILURE;
        }
        printf("Manufacturer: %s, Description: %s\n\n", manufacturer, description);
        curdev = curdev->next;
    }

    octopus_list_free(&devlist);
    octopus_deinit(&octopusc);
#endif
    return EXIT_SUCCESS;
}
